#ifndef GRAPHICSVIEW_H
#define GRAPHICSVIEW_H

#include <QObject>
#include <QWidget>
#include <QGraphicsView>
#include <QMouseEvent>

class GraphicsView : public QGraphicsView
{
    Q_OBJECT
public:
    explicit GraphicsView(QWidget *parent = nullptr);

signals:
    void drawingStarted(const QPointF &startPos);
    void drawingMoved(const QPointF &newPos);
    void drawingEnd(const QPointF &endPos);
protected:
    void mousePressEvent(QMouseEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;
    void mouseReleaseEvent(QMouseEvent *event) override;
private:
    QPointF m_prePos;
    bool m_drawingMode;
};

#endif // GRAPHICSVIEW_H
